<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<title>Testing the Image Gallery</title>

	<!-- required: a default theme file -->
	<link rel="stylesheet" id="themeStyles" href="../../../dijit/themes/tundra/tundra.css">
	<link rel="stylesheet" href="../resources/image.css">
	
	<style type="text/css">
		@import "../../../dijit/tests/css/dijitTests.css";
	</style>

	<!-- required: dojo.js -->
	<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug:true, parseOnLoad: true"></script>

	<!-- do not use! only for testing dynamic themes -->
	<script type="text/javascript" src="../../../dijit/tests/_testCommon.js"></script>
	
	<!-- debugging includes -->
	<script type="text/javascript" src="../ThumbnailPicker.js"></script>
	<script type="text/javascript" src="../SlideShow.js"></script>
	<script type="text/javascript" src="../Gallery.js"></script>
	<script type="text/javascript" src="../../data/GoogleSearchStore.js"></script>

	<script type="text/javascript">
		dojo.require("dojox.image.Gallery");
		dojo.require("dojox.data.GoogleSearchStore");
		dojo.require("dojox.data.FlickrRestStore");
		dojo.require("dojo.parser");	// find widgets

		dojo.addOnLoad(function(){
			var googleImageStore = new dojox.data.GoogleImageSearchStore();
			var req = {
				query: {
					text: "kinsale"
				},
				count: 32
			};
			// testCommon defers parsing by a little, so dijit's aren't ready
			// in addOnLoad for soria/nihilo :(
			setTimeout(function(){ 
				dijit.byId('gallery1').setDataStore(googleImageStore, req);	
			},250);
		});
		
		function changeStore(){
			var flickrRestStore = new dojox.data.FlickrRestStore();
			var req = {
				query: {
					userid: "44153025@N00",
					apikey: "8c6803164dbc395fb7131c9d54843627",
					sort: [
						   {
							attribute: "interestingness",
							descending: true
							}
						   ],
					tag_mode: "any"
				},
				count: 20
			};
			dijit.byId('gallery1').setDataStore(flickrRestStore, req, {
			  imageThumbAttr: "imageUrlThumb",
			  imageLargeAttr: "imageUrl",
			  titleAttr: "title"
			  
			});				
		}
	</script>
</head>
<body class="tundra">
	<h1 class="testTitle">dojox.image.Gallery</h1>

	<h2>From GoogleImageSearchStore:</h2>
	
	<button onclick="changeStore()">Change Datastore</button>
	
	<div id="gallery1" dojoType="dojox.image.Gallery" imageWidth="700" imageHeight="500" 
		imageThumbAttr="tbUrl" imageLargeAttr="unescapedUrl" titleAttr="titleNoFormatting"></div>

</body>
</html>
